<template>
  <div class="login-wrapper">
    <div class="form">
      <el-card>
        <!--{{userState.fps}}-->
        <!--{{userState.time}}-->
        <!--{{userState.location}}-->
        <!--{{title}}-->
        {{userState.geoLocation}}
        <el-row>
          用户名:<el-input v-model="userState.username"></el-input>
        </el-row>
        <el-row>
          密码:<el-input v-model="userState.password"
          type="password"
          ></el-input>

          <el-button type="primary">登录</el-button>
          <el-button type="primary">注册</el-button>
        </el-row>
      </el-card>
    </div>
  </div>
</template>

<script>
import {reactive} from "vue";
import axios from "axios";
import {useBrowserLocation, useFps, useGeolocation, useTimeAgo, useTitle} from "@vueuse/core/index";

export default {
  name: "Login.vue",
  setup() {
    console.log('login')
    const userState = reactive({
      username: 'admin',
      password: 'admin',
      fps: '',
      location:'',
      title:''

    })
    axios.post('/api/auth/login',userState).then(res=>{
      console.log('res',res)
    })

    // userState.fps = useFps()
    // userState.location =useBrowserLocation()
    // userState.time = useTimeAgo(new Date(),{hour:-2})
    // const title = useTitle()
    // console.log('userState',userState)
    // title.value= 'nihao'
    userState.geoLocation = useGeolocation()
    console.log('userState',userState.geoLocation.coords)
    return {
      userState,
      // title
    }
  },
}
</script>

<style lang="scss" scoped>
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  background-image: url(src/assets/img/background/bg-earth.png);
  background-size: cover;
}
</style>
